import time
from selenium.webdriver.common.by import By
from common.Utils import ForumDriver



class ForumMypost:
    driver = ""

    def __init__(self):
        self.driver = ForumDriver.driver

    def MypostPageelements(self):
        self.driver.find_element(By.CSS_SELECTOR,"#index_nav_avatar").click()
        #点击我的贴子
        self.driver.find_element(By.CSS_SELECTOR,"#index_user_profile").click()
        time.sleep(3)

        #检查用户的头像
        self.driver.find_element(By.CSS_SELECTOR,"#profile_avatar")
        #检查用户的昵称
        self.driver.find_element(By.CSS_SELECTOR,"#profile_nickname")
        #检查发帖数
        text1 = self.driver.find_element(By.CSS_SELECTOR,"#bit-forum-content > div.page-header.d-print-none > div > div > div.col > div > div:nth-child(1)").text
        print("用户发帖数："+text1)
        #检查邮箱
        text2 = self.driver.find_element(By.CSS_SELECTOR,"#bit-forum-content > div.page-header.d-print-none > div > div > div.col > div > div:nth-child(2)").text
        print("用户邮箱：" + text2)
        #检查注册日期
        text3 = self.driver.find_element(By.CSS_SELECTOR,"#bit-forum-content > div.page-header.d-print-none > div > div > div.col > div > div:nth-child(3)").text
        print("用户注册日期：" + text3)
        #检查第一篇贴子的标题
        self.driver.find_element(By.CSS_SELECTOR,"#profile_article_body > li:nth-child(1) > div.card.timeline-event-card > div > div > div > div > div.text-truncate > a > strong")
        #检查第一篇贴子的发布时间
        self.driver.find_element(By.CSS_SELECTOR,"#profile_article_body > li:nth-child(1) > div.card.timeline-event-card > div > div > div > div > div.text-muted.mt-2 > div > div.col > ul > li")
        #检查个人介绍
        text4 = self.driver.find_element(By.CSS_SELECTOR,"#profile_remark").text
        print("用户个人介绍" + text4)


